package com.wmada.toolkit.ffmpeg;

import com.wmada.toolkit.rpc.CmdExecutor;

/**
 * @author will.ma
 * @date 2020-11-3
 */
public class FfmpegExecutor extends CmdExecutor {

    public FfmpegExecutor() {
        super("ffmpeg", "-hide_banner");
    }

    public FfmpegExecutor(String appPath) {
        super(appPath, "-hide_banner");
    }

    public FfmpegExecutor(String appPath, String... defaultArgs) {
        super(appPath, defaultArgs);
    }

    public FfmpegExecutor setLogLevel(String level) {
        this.addArgs("-v", level);
        return this;
    }

    public FfmpegExecutor error() {
        return setLogLevel("error");
    }

    public FfmpegExecutor warning() {
        return setLogLevel("warning");
    }

    public FfmpegExecutor info() {
        return setLogLevel("info");
    }

    public FfmpegExecutor quiet() {
        return setLogLevel("quiet");
    }

    public FfmpegExecutor json() {
        this.addArgs("-of", "json");
        return this;
    }

}
